<?php

use console\services\MigrateService;
use yii\db\Migration;

/**
 * Handles the creation of table `sys_notice`.
 */
class m231229_144111_create_sys_notice_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_notice', [
            'id' => $this->bigPrimaryKey(),
            'title' => $this->string(64)->defaultValue('')->null()->comment('公告标题'),
            'type' => $this->char(1)->defaultValue('1')->null()->comment('公告类型1通知2公告'),
            'summary' => $this->string(128)->defaultValue('')->null()->comment('简介'),
            'content' => $this->text()->null()->comment('公告内容'),
            'status' => $this->char(1)->defaultValue('1')->null()->comment('公告状态（1正常 0关闭）'),
            'create_by' => $this->string(32)->defaultValue('')->null()->comment('创建人'),
            'update_by' => $this->string(32)->defaultValue('')->null()->comment('更新人'),
            'create_time' => $this->bigInteger()->defaultValue(0)->null()->comment('创建时间'),
            'update_time' => $this->bigInteger()->defaultValue(0)->null()->comment('更新时间'),
        ], MigrateService::createTableOptions('通知公告表'));
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_notice');
    }
}
